home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 89 / 089.d81 / snake source (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  8KB  |  257 lines

  1. 100 rem snake v1.0 *  completed 9/90 * edited 9/6/91 by david caruso ii
  2. 110 poke53265,11:dv=peek(186):ifdv<8thendv=8
  3. 120 a=2:f4=3
  4. 130 poke53272,24:gosub1020
  5. 140 poke54272,0:v=54276:t=54273:poke54296,15:a=rnd(ti)
  6. 150 c=1:sc=0:f=0:p=0:o=0:poke53280,14:poke53281,0:c5=0:mo=0:ys=0:hx=0:lh=0:sp=bs
  7. 160 bo=0:bn=int(rnd(1)*200)+400
  8. 170 poke53265,11:gosub1780:poke53265,27
  9. 180 goto1070
  10. 190 gosub200:goto350
  11. 200 poke53280,14
  12. 210 poke53265,11:print"[154][147]   \snake\    score          [211]   [255]      [146]";:gosub1270
  13. 220 a=f:gosub1010:ifa=0thenb$=" "
  14. 230 print"";b$;"[146]";:pokev,17:di=0
  15. 240 forg=1to23:print" [146]                                       [146]";:poket,g*2
  16. 250 next:pokev,16
  17. 260 print"                                       [146]":poke2023,160:poke53265,27
  18. 270 hb=int(rnd(1)*3)+5
  19. 280 cs=7:return
  20. 290 ifk=-1ork=1thena=67:goto310
  21. 300 a=66
  22. 310 sc=sc+1:e=e+1:ife>uthengosub1530
  23. 320 return
  24. 330 gosub2220:sh=3:ly=int(l/40):lx=l-(ly*40):sp=sp-6:poke1054,160:poke1058,160
  25. 340 mf=f:mp=o:f=0:o=0:poke1058,160:goto450
  26. 350 a=int(rnd(1)*20)+11:g=int(rnd(1)*9)+8:l=(g*40)+a
  27. 360 a=int(rnd(1)*4)+1:k=1:ifa=2thenk=-1
  28. 370 ifa=3thenk=40
  29. 380 ifa=4thenk=-40
  30. 390 gosub890
  31. 400 ifsh=0thensc=sc+1:ex=ex+1:poke1024+l,87:poke55296+l,5:e=e+1:ife>uthengosub1530
  32. 410 ifdi=1thengosub1680
  33. 420 ifmo=1thengosub2300:ifc5=1then1370
  34. 430 bo=bo+1:ifbo>bnthengosub1550
  35. 440 iflh>1thenlh=lh-1:iflh=1then330
  36. 450 iflh=1thengosub290:poke55296+l,c:poke1024+l,a:gosub2150
  37. 460 ifp>0thenpokev,17:poket,p:forg=1to1:next:pokev,16
  38. 470 a=sc:gosub1010:print"[154]";b$:goto490
  39. 480 pokev,17:poket,47:forg=1to1:next:pokev,16:return
  40. 490 forg=1tosp:next:geta$:ifa$=""then610
  41. 500 if(a$="k"ora$="")andk<>40andk<>-40thenk=40:gosub480:jd=1:goto620
  42. 510 if(a$="i"ora$="[145]")andk<>-40andk<>40thenk=-40:gosub480:jd=1:goto620
  43. 520 if(a$="l"ora$="")andk<>1andk<>-1thenk=1:gosub480:jd=1:goto620
  44. 530 ifa$="s"thengosub1510
  45. 540 if(a$="j"ora$="[157]")andk<>-1andk<>1thenk=-1:gosub480:jd=1:goto620
  46. 550 ifcs=7anda$=" "then490
  47. 560 ifa$=" "andf>0thenpoke53265,11:gosub2480:mo=0:gosub2250:gosub200:goto620
  48. 570 if(a$="u"ora$=chr$(13))ando>0ora$="p"ando>0thenp=40:o=o-1:gosub1270:goto620
  49. 580 ifa$="-"thensp=sp+2:bs=bs+2:goto620
  50. 590 ifa$=chr$(3)thengosub1350
  51. 600 ifa$="+"thengosub720
  52. 610 cs=0:jy=peek(56320)or128:ifjy<>255then2080
  53. 620 gosub830
  54. 630 h=peek(k+l+1024):ifh<>32then750
  55. 640 ifp=0then660
  56. 650 p=p-1:c=int(p/3)+2
  57. 660 poke55296+l,c:poke1024+l,de:ifp=0thenc=1:nh=0
  58. 670 ifsh=7then1370
  59. 680 k2=k:l=l+k:fs=fs+1:iffs=30thenfs=0:gosub920
  60. 690 ifpeek(k+l+1024)=87thensp=sp+6:gf=1
  61. 700 w=w+1:ifw>hbthen1310
  62. 710 goto400
  63. 720 sp=sp-2:ifsp<0thensp=0
  64. 730 bs=bs-2:ifbs<0thenbs=0
  65. 740 return
  66. 750 ifh=83thenpoke53280,1:sc=sc+25:goto960
  67. 760 ifh=90andp=0andlh<>1then1650
  68. 770 ifh>128andh<192then910
  69. 780 ifh=94thenpoke53280,1:sc=sc+25:goto1240
  70. 790 ifh=87thensh=0:sp=sp+6:lh=0:gosub2230:goto660
  71. 800 ifp>0then650
  72. 810 ifh=90andlh=1then660
  73. 820 sh=7:goto660
  74. 830 ifjd=3thenreturn
  75. 840 ifjd=2then890
  76. 850 jd=2:ifk=1andk2=40ork=-40andk2=-1thende=109:return
  77. 860 ifk=40andk2=-1ork=1andk2=-40thende=112:return
  78. 870 ifk=-1andk2=40ork=-40andk2=1thende=125:return
  79. 880 de=110:return
  80. 890 jd=3:ifk=-40ork=40thende=66:return
  81. 900 de=67:return
  82. 910 sh=7:goto660
  83. 920 forg=1to2:pokev,17:poket,20:forh=1to10:next:pokev,16:forh=1to35:next:next
  84. 930 a=int(rnd(1)*10)+1:ifa>5then1160
  85. 940 a=int(rnd(1)*917)+42:ifpeek(1024+a)=160then920
  86. 950 poke55296+a,10:poke1024+a,83:return
  87. 960 pokev,33:poket,10:forg=1to15:next:pokev,32
  88. 970 iff=1then990
  89. 980 f=f+1:a=f:gosub1010:print"";b$
  90. 990 poke53280,14:iflh=1thena$=" ":goto560
  91. 1000 goto660
  92. 1010 b$=str$(a):b$=right$(b$,len(b$)-1):return
  93. 1020 f4=5:a=rnd(ti):close8:open15,dv,15:open8,dv,8,"snake file,s,r"
  94. 1025 input#8,hs,bs,na$:input#15,a$:close8:f4=0
  95. 1030 forg=54272to54296:pokeg,0:next:poke54277,30:poke54278,0:so=1
  96. 1040 iflen(na$)=0thenna$="john galt"
  97. 1050 ifbs<1thenbs=70
  98. 1060 return
  99. 1070 geta$:ifa$=""then1070
  100. 1080 ifa$="q"then1110
  101. 1090 ifa$="[200]"then1180
  102. 1100 goto190
  103. 1110 printc$;"[145][145][145][145][145][145][145][157][157][157][157][157][157][157][157][157][157][157][157] sure? (y/n)"
  104. 1120 geta$:ifa$<>"y"anda$<>"n"then1120
  105. 1130 ifa$="y"then2570
  106. 1140 printc$;"[145][145][145][145][145][145][145][157][157][157][157][157][157][157][157][157][157][157][157]            ";
  107. 1150 gosub2050:goto1070
  108. 1160 a=int(rnd(1)*917)+42:ifpeek(1024+a)=160then1160
  109. 1170 poke55296+a,7:poke1024+a,94:return
  110. 1180 rem clear high score
  111. 1190 printc$;"[158]            \\\ clearing \\\        ";
  112. 1200 close15:open15,dv,15:print#15,"s0:snake file":close15
  113. 1210 bs=70:hs=100:na$="john galt"
  114. 1220 close8:open8,dv,8,"snake file,s,w":print#8,hs:print#8,bs:print#8,na$:close8
  115. 1230 gosub2000:goto1070
  116. 1240 pokev,33:poket,30:forg=1to15:next:pokev,32
  117. 1250 ifo=3then1290
  118. 1260 o=o+1:gosub1270:goto1290
  119. 1270 a=o:gosub1010:ifa=0thenb$=" "
  120. 1280 print"";b$:return
  121. 1290 poke53280,14:iflh=1thenpoke198,1:poke631,47
  122. 1300 goto660
  123. 1310 a=int(rnd(1)*917)+42:ifpeek(1024+a)<>32andck<5thenck=ck+1:goto1310
  124. 1320 forg=1to4:ifa=(k*g)+lthenpoke64,206:goto1310
  125. 1330 next:ck=0:pokev,17:poket,11:forg=1to10:next:pokev,16
  126. 1340 poke1024+a,214:poke55296+a,15:w=0:goto400
  127. 1350 geta$:ifa$=""then1350
  128. 1360 return
  129. 1370 poke53280,2:pokev,129:forg=100to20step-1:poket,g:next:forg=1to10:next:sh=0
  130. 1380 a=hx:gosub1010:a$="bonus \"+b$:sc=sc+hx
  131. 1390 a=sc:gosub1010:a$=a$+"\  final score \"+b$+"\"
  132. 1400 b$="                                        ":print"[154]";b$
  133. 1410 a$=left$(b$,20-int(len(a$)/2))+a$:print"";a$
  134. 1420 pokev,128:poket,0:poke54272,0:poke198,0:ifsc>hsthenhs=sc:goto1460
  135. 1430 print"[154]             (press a key)              [146]"
  136. 1440 geta$:ifa$=""then1440
  137. 1450 goto150
  138. 1460 a$="?":print"  high score!   your name:            [157][157][157][157][157][157][157][157][157][157][157]";
  139. 1470 gosub1700:na$=m$
  140. 1480 close15:open15,dv,15:print#15,"s0:snake file":close15
  141. 1490 close8:open8,dv,8,"snake file,s,w":print#8,hs:print#8,bs:print#8,na$:close8
  142. 1500 goto1430
  143. 1510 ifso=1thenpoke54296,0:so=0:return
  144. 1520 so=1:poke54296,15:return
  145. 1530 hb=hb-1:e=0:u=int(rnd(1)*30)+90:ifhb<2thenhb=2
  146. 1540 return
  147. 1550 bn=int(rnd(1)*200)+400:bo=0
  148. 1560 a=int(rnd(1)*3)+1:ifa<>2thenreturn
  149. 1570 a=int(rnd(1)*1000)+1:ifpeek(1024+a)=32then1600
  150. 1580 cr=cr+1:ifcr=6thenreturn
  151. 1590 goto1570
  152. 1600 cr=0:sl=a:poke1024+a,90:poke55296+a,3:di=1
  153. 1610 pokev,17:forg=80to190:poket,g:next:pokev,16:return
  154. 1620 iff4=5thenhs=100:na$="john galt":sp=70:close8:f4=0:gosub1030:goto140
  155. 1630 iff4=3thengosub1020:goto140
  156. 1640 poke53280,0:poke53265,11:forg=1to2000:next:poke186,dv:run
  157. 1650 a=53280:pokea,11:sc=sc+500:pokev,17:forg=20to90:poket,g:next:pokea,12:di=0
  158. 1660 forg=90to60step-1:poket,g:next:pokea,15
  159. 1670 forg=60to130:poket,g:next:pokev,16:pokea,14:goto660
  160. 1680 j=j+1:ifj=16thenj=1
  161. 1690 poke55296+sl,j:return
  162. 1700 m$="":m=0
  163. 1710 geta$:ifa$=""then1710
  164. 1720 a=asc(a$):ifa=32ora=46then1760
  165. 1730 ifa$=chr$(13)andm>0thenreturn
  166. 1740 ifa=20andm>0then1770
  167. 1750 ifa<65ora>90orm=11then1710
  168. 1760 m=m+1:m$=m$+a$:print"";a$;:goto1710
  169. 1770 m=m-1:m$=left$(m$,m):print"[157] [157]";:goto1710
  170. 1780 ws=1:poke53280,2:print"[158][147]               s n a k e                ";
  171. 1790 print"                                        ";
  172. 1800 print"           by david caruso ii           ";
  173. 1810 print"                                        ";
  174. 1820 print"[146][155]guide your snake between walls and"
  175. 1830 print"rocks. collect special items along"
  176. 1840 print"the way. use fire ([150][211][155]) to clear area."
  177. 1850 print"bonus is awarded for things burned.
  178. 1860 [153]"use power (sys(NULL)list) to pound through all"
  179. 1870 [153]"obstacles and collect items. do not"
  180. 1880 [153]"lose your mind while playing.":[153]"contfrefrefrefrefrefrefrefre"
  181. 1890 [153]" points wait  def(NULL)cont..25  sys(NULL)cont..25  print(NULL)cont..500  openspc(cont..?":[153]"pospospospospospospospos"
  182. 1900 [153]"              keys to use               wait";
  183. 1910 [153]"pospospospospos        pospospospospospospospospospospos"
  184. 1920 [153]" [i] wait listnorth   [space]   wait liststart fire"
  185. 1930 [153]" [k] wait listsouth   [u] [p]   wait listuse power"
  186. 1940 [153]" [j] wait listwest    [s